@Entity public class Order { @Id int orderId; ... @OneToMany(cascade=PERSIST, orphanRemoval=true) Set<Item> lineItems; }
@Entity public class Employee { @Id Integer id String name; @Max(15) Integer vacationDays; @Valid Address worksite; // ... } @Embeddable public class Address { @Size(max=30) String street; @Size(max=20) String city; @Zipcode String zipcode; // ... }